Skip to content

fix: Preserve host application logging configuration#2010

Draft
vdusek wants to merge 2 commits into
masterfrom
worktree-fix-first-run-embedding-surprises
Draft

fix: Preserve host application logging configuration#2010
vdusek wants to merge 2 commits into
masterfrom
worktree-fix-first-run-embedding-surprises

Conversation

@vdusek

@vdusek vdusek commented Jul 2, 2026

Copy link
Copy Markdown
Collaborator

Problem

BasicCrawler.__init__ (with the default configure_logging=True) called configure_logger(root_logger, remove_old_handlers=True), wiping the host application's root logging handlers. Embedding Crawlee in a larger app silently removed the host's own logging configuration.

Changes

The root logger (and the httpx logger) is now configured only when the root logger has no handlers yet, mirroring logging.basicConfig semantics. A host that has already configured logging keeps its configuration.

Verification

Two regression tests that fail without the fix: one asserts host-installed root handlers survive crawler construction, the other asserts Crawlee still configures an unconfigured root logger.

Behavior change

This intentionally changes observable behavior, since the old behavior was the bug: host apps keep their logging config.

@vdusek vdusek self-assigned this Jul 2, 2026
@vdusek vdusek added t-tooling Issues with this label are in the ownership of the tooling team. adhoc Ad-hoc unplanned task added during the sprint. labels Jul 2, 2026
@codecov

codecov Bot commented Jul 2, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 93.35%. Comparing base (7780e78) to head (7781398).
⚠️ Report is 3 commits behind head on master.

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #2010   +/-   ##
=======================================
  Coverage   93.35%   93.35%           
=======================================
  Files         179      179           
  Lines       12482    12483    +1     
=======================================
+ Hits        11652    11654    +2     
+ Misses        830      829    -1     
Flag Coverage Δ
unit 93.35% <100.00%> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@vdusek vdusek changed the title fix: Preserve host logging, keep named request queues across runs, fix adaptive-crawler extra fix: Preserve host application logging configuration Jul 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

adhoc Ad-hoc unplanned task added during the sprint. t-tooling Issues with this label are in the ownership of the tooling team.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants